import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

const state = {
  activityId: "", //当前专场项目ID  this.$store.state.activityId
  disabled: false, // 切换活动按钮
  activeTop: "1", // 顶部导航选中
  leftNav: "ticketList",
  ticketList: [], //门票的数据  this.$store.state.ticketList
  refundList: [], //退款信息  this.$store.state.refundList
  allTableData: [], //门票的数据  this.$store.state.allTableData
  protocolList: [], //协议的数据  this.$store.state.protocolList
  foruList: [], //论坛管理表格list this.$store.state.foruList
  priceList: [], //价格组数据 this.$store.state.priceList
  shareList: [], //分享列表 this.$store.state.shareList
  fieldList: [], //字段管理 this.$store.state.fieldList
  powerManageList: [] //会务活动表格数据 this.$store.state.powerManageList
};

const getters = {
  activityId: state => state.activityId,
  activeTop: state => state.activeTop,
  leftNav: state => state.leftNav,
  disabled: state => state.disabled
};

const mutations = {
  SET_ACTIVITY_ID: (state, activityId) => {
    state.activityId = activityId;
  },
  SET_ACTIVE_TOP: (state, activeTop) => {
    state.activeTop = activeTop;
  },
  SET_LEFT_NAV: (state, leftNav) => {
    state.leftNav = leftNav;
  },
  SET_DISABLED: (state, disabled) => {
    state.disabled = disabled;
  }
};

const actions = {
  setActivityId: ({ commit }, activityId) => {
    return commit("SET_ACTIVITY_ID", activityId);
  },
  setActiveTop: ({ commit }, activeTop) => {
    return commit("SET_ACTIVE_TOP", activeTop);
  },
  setLeftNav: ({ commit }, leftNav) => {
    return commit("SET_LEFT_NAV", leftNav);
  },
  setDisabled: ({ commit }, disabled) => {
    return commit("SET_DISABLED", disabled);
  }
};

export default new Vuex.Store({
  state,
  getters,
  mutations,
  actions
});
